﻿using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace KinTN_WMS_CL.DialogView
{
    /// <summary>
    /// Window1.xaml 的交互逻辑
    /// </summary>
    public partial class MaterialStorageDetailsView : UserControl
    {
        private Point mouseOffset;
        private bool getPosition = false;
        public MaterialStorageDetailsView()
        {
            InitializeComponent();
        }


        private void Grid_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                getPosition = true;
                mouseOffset = e.GetPosition(this);
                // 你可以在这里设置其他初始化操作
            }
        }

        private void Grid_OnMouseMove(object sender, MouseEventArgs e)
        {
            if (getPosition && e.LeftButton == MouseButtonState.Pressed)
            {
                var window = HandyControl.Controls.Window.GetWindow(this);
                if (window != null)
                {
                    window.DragMove();
                }
            }
        }

        private void Grid_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                getPosition = false;
            }
        }
    }
}
